// TypeScript file
module Fighter {

    /**
     * 升级Ui——郭启航
     */
    export class UpdateUI extends eui.Component {

        constructor() {
            super();
            this.skinName = "resource/assets/PlaneE/Update.exml"
            this.addEventListener(egret.Event.ADDED_TO_STAGE, this.onAddToStage, this)
        }
        /**返回按钮*/
        public Update_back: eui.Button;
        /**返回bool值*/
        public Is_back: boolean;
        /**加攻击*/
        // public Update_AKT: eui.Button;
        // /**加护甲*/
        // public Update_ARM: eui.Button;
        // /**加血量*/
        // public Update_Hp: eui.Button;
        // /**加子弹排数*/
        // public Update_double: eui.Button;
        /**金币提示*/
        public Update_MoneyShow: eui.Label;
        public onAddToStage() {
            this.Update_back.addEventListener(egret.TouchEvent.TOUCH_TAP, this.Close, this);
            this.addEventListener(egret.Event.ENTER_FRAME, this.show, this)
           // this.Update_AKT.addEventListener(egret.TouchEvent.TOUCH_TAP, this.AKT, this);     
           // this.Update_ARM.addEventListener(egret.TouchEvent.TOUCH_TAP, this.ARM, this);
            //this.Update_Hp.addEventListener(egret.TouchEvent.TOUCH_TAP, this.Hp, this);
            //this.Update_double.addEventListener(egret.TouchEvent.TOUCH_TAP, this.double, this);
        }
        public Close() {
            this.Is_back = true;
        }
        /**每帧更新提示信息*/
        public show() {
            this.Update_MoneyShow.text = "金币：" + GameUtil.PlayerMessage.instance.money;
        }
        public AKT() {

        //  GameUtil.PlayerMessage.instance.atk+= this.expenditureMoney();

        }
        public Hp() {
             GameUtil.PlayerMessage.instance.playHp+= this.expenditureMoney();
        }
        // public double() {
        //     if (PlayerMsg.instance.money >= 10000) {
        //         PlayerMsg.instance.money -= 10000;
        //         PlayerMsg.instance.bullet_row += 1;
        //     }
        // }
        // public ARM() {

        //      PlayerMsg.instance.armor+= this.expenditureMoney();

        // }
      /**升级攻击力*/
        public expenditureMoney(): number {
            if (GameUtil.PlayerMessage.instance.money >= 100) {             
              var capacityNum:number=0 ;
              capacityNum+=1
                GameUtil.PlayerMessage.instance.money -= 100;
                
                return capacityNum;
               
            }
        }

    }
}